package builder.demo1;

/**
 * 具体的构建器类，这里是华为电脑构造类
 */
public class HwComputerBuilder implements ComputerBuilder {

    // Computer 中对应的各个属性
    private String cpu; // cpu
    private String graphics; // 显卡
    private String power; // 电源
    private String mainBoard; // 主板
    private String monitor;// 显示器
    private String disk; // 磁盘

    @Override
    public void builderCpu(String cpu) {
        this.cpu = cpu;
    }

    @Override
    public void builderGraphics(String graphics) {
        this.graphics = graphics;
    }

    @Override
    public void builderPower(String power) {
        this.power = power;
    }

    @Override
    public void builderMainBoard(String mainBoard) {
        this.mainBoard = mainBoard;
    }

    @Override
    public void builderMonitor(String monitor) {
        this.monitor = monitor;
    }

    @Override
    public void builderDisk(String disk) {
        this.disk = disk;
    }

    // 各个部件构造完成后，提供对外产品实例(有点像工厂)
    @Override
    public Computer buildComputer() {

        return new Computer(this.cpu,this.graphics,this.power,this.mainBoard,this.monitor,this.disk);
    }
}
